Loading Packages


library(meta)
library(readxl)

Importing the Dataset


The entire dataset was converted into a dataframe format for easier handling and compatibility with the R example analysis. The dataframe structure allows seamless data manipulation and analysis using R’s built-in functions and packages.

##                   Author Year event.e   n.e event.c  n.c  p2y12_type
## 1  Almendro-Delia et al. 2015     188  3973     116 2076 Clopidogrel
## 2         ATLANTIC Trial 2014      30   906      19  952  Ticagrelor
## 3         Danchin et al. 2018       9   360      18  360 Clopidogrel
## 4          Load&Go Trial 2013       2    56       0   56 Clopidogrel
## 5           CIPAMI Trial 2012       1   164       4  171 Clopidogrel
## 6          Fabris et al. 2022      17   237      17  300 Clopidogrel
## 7          Postma et al. 2014      46  1345      35 1096 Clopidogrel
## 8          Dorler et al. 2011      55  1635     110 1076 Clopidogrel
## 9            Lupi et al. 2016       5   143      13  143  Ticagrelor
## 10        Redfors et al. 2019    1960 37840     528 6964 Clopidogrel
## 11           Yudi et al. 2018      25   892      96 1915 Clopidogrel
## 12      Alexander et al. 2008      12  1029      55 2756  Ticagrelor
## 13          Fefer et al. 2009      12   217       6  166 Clopidogrel
## 14            Lev et al. 2008       1   165       2  127 Clopidogrel
##      overal_risk_of_bias pretreatment_timing %_HTN
## 1   Serious-risk of Bias        Pre-hospital  30.0
## 2       Low-risk of Bias        Pre-hospital  28.8
## 3       Low-risk of Bias        Pre-hospital  25.9
## 4  Moderate-risk of Bias        Pre-hospital  52.3
## 5       Low-risk of Bias        Pre-hospital  49.8
## 6  Moderate-risk of Bias        Pre-hospital  30.5
## 7   Serious-risk of Bias        Pre-hospital  20.3
## 8  Moderate-risk of Bias        Pre-hospital  40.1
## 9   Serious-risk of Bias        Pre-hospital  60.6
## 10 Moderate-risk of Bias        Pre-hospital  40.5
## 11 Moderate-risk of Bias        Pre-hospital  43.4
## 12  Serious-risk of Bias         In-hospital  61.4
## 13  Serious-risk of Bias         In-hospital  32.6
## 14  Serious-risk of Bias         In-hospital  70.1

Performing Subgroup Analyses


Before running any meta-analysis function (e.g., metabin(), metacont(), metaprop(), metagen(), or others), it is essential to reorder the levels of the subgroup variable in your dataset. The order of these levels determines how the subgroups will appear in the forest plot.

To adjust the order in which the subgroup levels will appear in the forest plot, use the factor() function:

ma$acm$overal_risk_of_bias = factor(ma$acm$overal_risk_of_bias, 
                                     levels = c("Low-risk of Bias", "Moderate-risk of Bias", "Serious-risk of Bias"))

ma$acm$p2y12_type = factor(ma$acm$p2y12_type, 
                            levels = c("Clopidogrel", "Ticagrelor"))

ma$acm$pretreatment_timing = factor(ma$acm$pretreatment_timing, 
                                    levels = c("Pre-hospital", "In-hospital"))

First Step = Performing the Meta-Analysis


To perform a subgroup analysis, use the subgroup (replaces the old byvar argument) argument in the meta-analysis function. This argument specifies the column in your dataset containing the subgroup definitions. The results will then be grouped by these subgroups and displayed in a structured format in the forest plot:

m.acm <- metabin(event.e, n.e, event.c, n.c,
                 data = ma$acm,
                 method = "MH",
                 method.tau = "DL",
                 sm = "RR",
                 studlab = Author,
                 MH.exact = T,
                 print.subgroup.name = F)

summary(m.acm)
##                           RR             95%-CI %W(common) %W(random)
## Almendro-Delia et al. 0.8469 [0.6761;   1.0608]       11.0       13.0
## ATLANTIC Trial        1.6591 [0.9407;   2.9262]        1.3        8.3
## Danchin et al.        0.5000 [0.2277;   1.0981]        1.3        5.9
## Load&Go Trial         5.0000 [0.2455; 101.8321]        0.0        0.6
## CIPAMI Trial          0.2607 [0.0294;   2.3078]        0.3        1.2
## Fabris et al.         1.2658 [0.6606;   2.4255]        1.1        7.3
## Postma et al.         1.0710 [0.6951;   1.6502]        2.8       10.1
## Dorler et al.         0.3291 [0.2403;   0.4506]        9.6       11.8
## Lupi et al.           0.3846 [0.1408;   1.0508]        0.9        4.3
## Redfors et al.        0.6832 [0.6227;   0.7495]       64.4       14.2
## Yudi et al.           0.5591 [0.3626;   0.8619]        4.4       10.1
## Alexander et al.      0.5844 [0.3142;   1.0867]        2.2        7.6
## Fefer et al.          1.5300 [0.5864;   3.9914]        0.5        4.6
## Lev et al.            0.3848 [0.0353;   4.1970]        0.2        1.0
## 
## Number of studies: k = 14
## Number of observations: o = 67120 (o.e = 48962, o.c = 18158)
## Number of events: e = 3382
## 
##                          RR           95%-CI     z  p-value
## Common effect model  0.6886 [0.6379; 0.7432] -9.57 < 0.0001
## Random effects model 0.7274 [0.5673; 0.9327] -2.51   0.0121
## 
## Quantifying heterogeneity:
##  tau^2 = 0.1108; tau = 0.3328; I^2 = 73.7% [55.4%; 84.5%]; H = 1.95 [1.50; 2.54]
## 
## Test of heterogeneity:
##      Q d.f.  p-value
##  49.46   13 < 0.0001
## 
## Details on meta-analytical method:
## - Mantel-Haenszel method, without continuity correction) (common effect model)
## - Inverse variance method (random effects model)
## - DerSimonian-Laird estimator for tau^2
## - Mantel-Haenszel estimator used in calculation of Q and tau^2 (like RevMan 5)
## - Continuity correction of 0.5 in studies with zero cell frequencies
##   (only used to calculate individual study results)

Second Step = Updating the Meta-Analysis Running the Subgroup Analyses


m.acm_ROB = update(m.acm, subgroup = overal_risk_of_bias, print.subgroup.name=F)
m.acm_P2Y12 = update(m.acm, subgroup = p2y12_type, print.subgroup.name=F)
m.acm_timing = update(m.acm, subgroup = pretreatment_timing, print.subgroup.name=F)

m.acm_ROB
## Number of studies: k = 14
## Number of observations: o = 67120 (o.e = 48962, o.c = 18158)
## Number of events: e = 3382
## 
##                          RR           95%-CI     z  p-value
## Common effect model  0.6886 [0.6379; 0.7432] -9.57 < 0.0001
## Random effects model 0.7274 [0.5673; 0.9327] -2.51   0.0121
## 
## Quantifying heterogeneity:
##  tau^2 = 0.1108; tau = 0.3328; I^2 = 73.7% [55.4%; 84.5%]; H = 1.95 [1.50; 2.54]
## 
## Test of heterogeneity:
##      Q d.f.  p-value
##  49.46   13 < 0.0001
## 
## Results for subgroups (common effect model):
##                         k     RR           95%-CI     Q   I^2
## Low-risk of Bias        3 1.0079 [0.6566; 1.5470]  7.49 73.3%
## Moderate-risk of Bias   5 0.6434 [0.5904; 0.7011] 25.43 84.3%
## Serious-risk of Bias    6 0.8402 [0.7005; 1.0077]  6.76 26.1%
## 
## Test for subgroup differences (common effect model):
##                    Q d.f. p-value
## Between groups 10.01    2  0.0067
## 
## Results for subgroups (random effects model):
##                         k     RR           95%-CI  tau^2    tau
## Low-risk of Bias        3 0.7641 [0.2630; 2.2197] 0.5864 0.7658
## Moderate-risk of Bias   5 0.6277 [0.4017; 0.9809] 0.1719 0.4146
## Serious-risk of Bias    6 0.8327 [0.6343; 1.0932] 0.0293 0.1712
## 
## Test for subgroup differences (random effects model):
##                   Q d.f. p-value
## Between groups 1.12    2  0.5703
## 
## Details on meta-analytical method:
## - Mantel-Haenszel method, without continuity correction) (common effect model)
## - Inverse variance method (random effects model)
## - DerSimonian-Laird estimator for tau^2
## - Mantel-Haenszel estimator used in calculation of Q and tau^2 (like RevMan 5)
## - Continuity correction of 0.5 in studies with zero cell frequencies
##   (only used to calculate individual study results)

Third Step = Creating the Forest Plot


To create a forest plot with subgroup analysis, use the forest() function and specify the subgroup-related arguments:

  • subgroup = TRUE
  • col.subgroup = "black"
  • prediction.subgroup = TRUE
forest(m.acm_ROB,
       smlab = "All-cause Mortality",
       layout = "Revman5",
       sortvar = TE,
       lab.e = "Experimental", label.left = "Favors Experimental",
       lab.c = "Control", label.right = "Favors Control",
       ff.lr = "bold",
       leftcols = c("studlab", "Year","event.e", "n.e", "event.c", "n.c", "w.random", "effect", "ci" ),
       leftlabs = c("Studies", "Year", NA, NA, NA, NA, NA, NA, NA),
       text.random = "Random effects model",
       random = TRUE, 
       common = FALSE,
       test.overall.random = TRUE,
       rightcols = FALSE,
       colgap = "3mm",
       fs.heading = 12,
       fs.study = 12, 
       fs.hetstat = 10, 
       digits = 2,
       digits.pval = 2,
       pooled.events = TRUE,
       pooled.totals = TRUE,
       print.I2.ci = TRUE,
       col.square="darkcyan", col.square.lines="black",
       prediction = TRUE, col.predict = "#CEF2EE",col.predict.lines = "black", ff.predict = 1,
       subgroup = T,
       col.subgroup = "black",
       prediction.subgroup = TRUE)


Fourth Step = Generating a Forest Plot With Results of Several Subgroup Analyses


m.acm_ROB = update(m.acm, subgroup = overal_risk_of_bias, print.subgroup.name=T, subgroup.name = "Overall Risk-of-bias")
m.acm_P2Y12 = update(m.acm, subgroup = p2y12_type, print.subgroup.name=F, subgroup.name = "P2Y12 Inhibitors")
m.acm_timing = update(m.acm, subgroup = pretreatment_timing, sprint.subgroup.name=F, subgroup.name = "Pretreatment Timing")
m.acm.subgroups= metabind(m.acm_ROB, m.acm_P2Y12, m.acm_timing, 
                          random = T,
                          common = F)

m.acm.subgroups
## Number of studies: k = 14
##                          RR           95%-CI     z p-value
## Random effects model 0.7274 [0.5673; 0.9327] -2.51  0.0121
## 
## Quantifying heterogeneity:
##  tau^2 = 0.1108; tau = 0.3328; I^2 = 73.7% [55.4%; 84.5%]; H = 1.95 [1.50; 2.54]
## 
## Test of heterogeneity:
##      Q d.f.  p-value
##  49.46   13 < 0.0001
## 
## Results for meta-analyses (random effects model):
##                        k     RR           95%-CI  tau^2    tau     Q   I^2
## Overall Risk-of-bias  14 0.7274 [0.5673; 0.9327] 0.1108 0.3328 49.46 73.7%
## P2Y12 Inhibitors      14 0.7274 [0.5673; 0.9327] 0.1108 0.3328 49.46 73.7%
## Pretreatment Timing   14 0.7274 [0.5673; 0.9327] 0.1108 0.3328 49.46 73.7%
## 
## Details on meta-analytical method:
## - Inverse variance method
## - DerSimonian-Laird estimator for tau^2
forest(m.acm.subgroups,
       layout = "meta",
       smlab = "All-cause Mortality",
       lab.e = "Experimental", label.left = "Favors Experimental",
       lab.c = "Control", label.right = "Favors Control",
       ff.lr = "bold", col.subgroup = "black", col.square = "black",
       leftcols = c("studlab", "k", "effect", "ci"),
       rightcols = c("pval.Q.b"),
       overall.hetstat=FALSE, overall=F)